'use strict';

module.exports = app => {
  const { DataTypes, BIGINT, DATE } = app.Sequelize;

  const Stuinsmsg = app.model.define('stuinsmsg', {
    id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true },
    content:{
        type:DataTypes.CHAR(120),
        allowNull:false
    },
    progress:{
        type:DataTypes.INTEGER,
        allowNull:false
    },
  },{
      tableName:'t_stu_ins_msg'
  });
  Stuinsmsg.associate = function(){
    app.model.Stuinsmsg.belongsTo(app.model.Teacher, {
        foreignKey: 'tea_id',
        as: 'teacher'
    }),
    app.model.Stuinsmsg.belongsTo(app.model.Student, {
        foreignKey: 'stu_id',
        as: 'student'
    })
  }
  return Stuinsmsg;
};